package org.jeecg.modules.meter.mapper;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.annotation.SqlParser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.entity.meter.MeterChangeInfo;
import org.jeecg.entity.meter.MeterChargeInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.vo.meter.MeterChargeRespVo;

/**
 * @Description: 仪表费用明细表
 * @Author: jeecg-boot
 * @Date:   2020-11-20
 * @Version: V1.0
 */
public interface MeterChargeInfoMapper extends BaseMapper<MeterChargeInfo> {

    List<MeterChargeInfo> getMeterCostDetail(@Param("meterId") String meterId);
    @SqlParser(filter = true)
    void refreshRemainAmount(@Param("meterChargeInfoList") List<MeterChargeRespVo> meterChargeInfoList);

    @SqlParser(filter = true)
    MeterChargeInfo getByOrderId(@Param("orderId") String orderId);

    @SqlParser(filter = true)
    void updateChargeStatus(@Param("id") String id,@Param("chargeStatus") Integer chargeStatus);
    @Select("select sum(charge_amount) from meter_charge_info where charge_type = '1' and meter_id =#{meterId}")
    BigDecimal queryAmount(@Param("meterId") String id);

    void updateRepairRead(@Param("bean") MeterChargeInfo meterChargeInfo);

    MeterChargeInfo getByReadId(String readId);

    List<MeterChargeInfo> findHisByMeterId(@Param("meterId") String meterId,@Param("chargeTime") Date chargeTime, @Param("meterChargeType") Integer meterChargeType);
}
